package com.example.service;

import com.example.mapper.UserinfoMapper;
import com.example.model.Userinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * UserService
 */
@Service
public class UserService {

    @Autowired
    private UserinfoMapper userinfoMapper;

    public Userinfo userDetail(Integer id){
        return userinfoMapper.selectByPrimaryKey(id);
    }

    public Userinfo userinfo(Integer id){
        return userinfoMapper.userInfo(id);
    }

    public List<Userinfo> selectByClum(String clum, String  value){
        Example example = new Example(Userinfo.class);
        example.createCriteria().andEqualTo(clum,value);
        return userinfoMapper.selectByExample(example);
    }

    public List<Integer> listRoles(Integer id){
        return userinfoMapper.listRoles(id);
    }
}
